package com.photoeditor.demo.ui.widget.collage;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.View;

import com.common.base.ComponentContext;
import com.common.base.app.BaseActivity;
import com.photoeditor.R;


public class BorderView extends View {

    private RectF borderRectf;
    private Paint mBorderPaint;
    private BaseActivity mActivity;
    private final static int BORDER_WIDTH = ComponentContext.getContext().getResources().getDimensionPixelSize(R.dimen.image_magazinecollage_border_width);

    public BorderView(Context context, RectF borderRectf) {
        super(context);
        this.borderRectf = borderRectf;
        mActivity = (BaseActivity) getContext();
        mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mBorderPaint.setStyle(Paint.Style.STROKE);
        mBorderPaint.setColor(getResources().getColor(R.color.accent_color));
        mBorderPaint.setStrokeWidth(BORDER_WIDTH);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawRect(0, 0, borderRectf.width(), this.getHeight(), mBorderPaint);
    }
}
